package oop.ex2.expression;

import oop.ex2.exceptions.UnrecognizedVariable;

/**
 * Implements the unary negation operator.
 * @author daniel
 */
public class NegOpNode extends UnaryOpNode {

	/**
	 * Construct a negation operator node using the matched string.
	 * @param matchedString The string that was matched that caused this node to be generated.
	 */
	public NegOpNode(String matchedString) {
		super(matchedString);
	}

	@Override
	public double calculateNode() throws UnrecognizedVariable {
		//return the negation of the child
		return -1 * _children.get(0).calculateNode();
	}

}
